package View.CidadeView;

import java.awt.Dimension;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.LayoutStyle.ComponentPlacement;

import Controller.CidadeController.CidadeController;
import Entidade.Cidade;
import framework.component.field.TTextField;
import framework.mvc.GenericView;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class CidadeView extends GenericView<Cidade> {

	private static final long serialVersionUID = -8857415586961585118L;
	private JLabel label;
	private JLabel lblStatusCidade;
	private JLabel lblTipo;
	private JButton button;
	private JButton button_1;
	private JLabel lblMunicipio;
	private JLabel lblCdfederal;
	private JLabel lblCdestadual;
	private JLabel lblCdrais;
	private JLabel lblVlrmininss;
	private JLabel lblCdDaPracasicred;
	private TTextField textField;
	private TTextField textField_1;
	private TTextField textField_2;
	private TTextField textField_3;
	private TTextField textField_4;
	private TTextField textField_5;
	private TTextField textField_6;
	private TTextField textField_7;
	private TTextField textField_8;

	public CidadeView() {
		super(new CidadeController());
		setTitle("Fox Empresarial - Cadastro de Cidades");
		setSize(new Dimension(350, 390));

		label = new JLabel("Nome:");

		lblStatusCidade = new JLabel("CEP: ");

		lblTipo = new JLabel("DDD:");

		button = new JButton("Salvar");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		button.setName("salvar");

		button_1 = new JButton("Cancelar");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			}
		});
		button_1.setName("cancelar");

		lblMunicipio = new JLabel("Municipio:");

		lblCdfederal = new JLabel("C\u00F3d.Federal: ");

		lblCdestadual = new JLabel("C\u00F3d.Estadual:");

		lblCdrais = new JLabel("C\u00F3d.Rais");

		lblVlrmininss = new JLabel("Vlr.Min.INSS:");

		lblCdDaPracasicred = new JLabel("C\u00F3d da Praca:");

		textField = new TTextField();
		textField.setName("NomeCidade");

		textField_1 = new TTextField();
		textField_1.setName("CEPCidade");

		textField_2 = new TTextField(TTextField.INTEGER);
		textField_2.setName("DDDCidade");

		textField_3 = new TTextField();
		textField_3.setName("MunicipioCidade");

		textField_4 = new TTextField();
		textField_4.setName("CodFederalCidade");

		textField_5 = new TTextField();
		textField_5.setName("CodEstadualCidade");

		textField_6 = new TTextField();
		textField_6.setName("RaisCidade");

		textField_7 = new TTextField(TTextField.DOUBLE);
		textField_7.setName("ValorMinINSSCidade");

		textField_8 = new TTextField();
		textField_8.setName("CodigoPracaSicredCidade");
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblMunicipio, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblCdfederal, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblCdestadual, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblCdrais, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblVlrmininss, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(label, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblStatusCidade, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblTipo, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblCdDaPracasicred, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(textField_2, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
						.addComponent(textField_3, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
						.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, 227, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_5, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_6, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_7, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_8, GroupLayout.PREFERRED_SIZE, 229, GroupLayout.PREFERRED_SIZE)
						.addComponent(textField_1, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
						.addComponent(textField, GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE))
					.addGap(8))
				.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
					.addContainerGap(166, Short.MAX_VALUE)
					.addComponent(button, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)
					.addGap(8)
					.addComponent(button_1, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addContainerGap()
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(label)
						.addComponent(textField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(15)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblStatusCidade)
						.addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblTipo)
						.addComponent(textField_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(12)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblMunicipio)
						.addComponent(textField_3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(ComponentPlacement.UNRELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblCdfederal)
						.addComponent(textField_4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblCdestadual)
						.addComponent(textField_5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblCdrais)
						.addComponent(textField_6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblVlrmininss)
						.addComponent(textField_7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblCdDaPracasicred)
						.addComponent(textField_8, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(18)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(button)
						.addComponent(button_1))
					.addGap(27))
		);
		groupLayout.linkSize(SwingConstants.VERTICAL, new Component[] {label, lblStatusCidade, lblTipo, lblMunicipio, lblCdfederal, lblCdestadual, lblCdrais, lblVlrmininss, lblCdDaPracasicred});
		groupLayout.linkSize(SwingConstants.VERTICAL, new Component[] {textField, textField_1, textField_2, textField_3, textField_4, textField_5, textField_6, textField_7, textField_8});
		groupLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {label, lblStatusCidade, lblTipo, lblMunicipio, lblCdfederal, lblCdestadual, lblCdrais, lblVlrmininss, lblCdDaPracasicred});
		groupLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {button, button_1});
		getContentPane().setLayout(groupLayout);
	}
}
